﻿using System;
using System.Collections.Generic;
using System.Windows.Data;
using System.Windows;

namespace PmuRegistry.Silverlight.Converters
{
	public class StringToDictionaryConverter : IValueConverter
	{		
		#region IValueConverter Members

		public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			//System.Diagnostics.Debug.WriteLine("Received Value is: " + value.ToString());
			//KeyValuePair<int, string> returnValue = new KeyValuePair<int,string>();
			//Dictionary<int, string> statuses = new Dictionary<int, string>();
			//statuses = ((App)Application.Current).StatusList;

			//if (statuses.Count > 0)
			//{
			//    foreach (KeyValuePair<int, string> item in statuses)
			//    {
			//        if (item.Value == value.ToString())
			//        {
			//            returnValue = item;
			//            break;
			//        }
			//    }
			//    return returnValue;
			//}
			//else
				return null;			
		}			

		public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
		{
			return ((KeyValuePair<int, string>)value).Key;
		}

		#endregion
	}
}
